<?php
/**
 * tpshop
 * ============================================================================
 * 版权所有 2015-2027 深圳搜豹网络科技有限公司，并保留所有权利。
 * 网站地址: http://www.tp-shop.cn
 * ----------------------------------------------------------------------------
 * Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
 * ============================================================================
 * Author: 当燃
 * Date: 2016-03-19
 */

namespace Home\Logic;

use Think\Model\RelationModel;
/**
 *
 * Class orderLogic
 * @package Home\Logic
 */
class OrderLogic extends RelationModel
{


    public function sms_log($mobile,$code,$order_id){
	
        //判断是否存在验证码
        $data = M('sms_log')->where(array('mobile'=>$mobile,'order_id'=>$order_id))->order('id DESC')->find();

        $row = M('sms_log')->add(array('mobile'=>$mobile,'code'=>$code,'add_time'=>time(),'session_id'=>session_id(),'order_id'=>$order_id));
        if(!$row)
		{
			$send = sendSMS($mobile,$code,$order_id);
		}
          //  return array('status'=>-1,'msg'=>'发送失败');
        //$send = sendSMS($mobile,'您好，你的验证码是：'.$code);
       // $send = sendSMS($mobile,$code,$order_id);
       // if(!$send)
       //     return array('status'=>-1,'msg'=>'发送失败');
        //return array('status'=>1,'msg'=>'发送成功');
    }
}